Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dashboard): Make FilterBar width resizable #20778

Merged
merged 9 commits into from
Jul 20, 2022

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Jul 19, 2022

SUMMARY

The current native filterbar section is fixed size.
Since the filter is not wide enough for moderately wide data to be seen, some filter value with the long overlapped prefix string such like the following case truncated with the repeated strings.

Screen Shot 2022-07-14 at 1 46 21 PM

There is an HTML tooltip that appear on mouseover but it's slow and bad user experience.
The dropdown needs to be widened over the sidebar but the dropdown also truncated under the sidebar to fix the #19399

Screen Shot 2022-07-19 at 2 14 41 PM

Therefore, this commit makes the sidebar resizable to be widened itself.
This commit adds the Resizable panel for native filterbar to adjust the width wider to help this inconvenient case.
It also stores the adjusted width for individual dashboard in localStorage to memorize the state.

Addition to the feature, this commit also migrates DashboardBuilder test code to testing-library, jest and typescript to enable emotion test helpers.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

resizaable-filterbar--before.mov

After:

resizable-filterbar--after.mov

TESTING IN

STRUCTIONS

  • Go to dashboard and then open the native filter menu
  • hover on the right edge of the menu
  • drag to adjust the width

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@ktmud
Copy link
Member

ktmud commented Jul 19, 2022

/testenv up

@github-actions
Copy link
Contributor

@ktmud Container image not yet published for this PR. Please try again when build is complete.

@github-actions
Copy link
Contributor

@ktmud Ephemeral environment creation failed. Please check the Actions logs for details.

Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if CI passes. Thanks for the comprehensive tests.

@@ -37,6 +37,7 @@ export const PLACEHOLDER_DATASOURCE: Datasource = {
export const MAIN_HEADER_HEIGHT = 53;
export const CLOSED_FILTER_BAR_WIDTH = 32;
export const OPEN_FILTER_BAR_WIDTH = 260;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename this to OPEN_FILTER_BAR_DEFAULT_WIDTH?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept this variable because some custom override might be impacted.

@@ -85,6 +86,7 @@ const ActionButtonsContainer = styled.div`
`;

export const ActionButtons = ({
width,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
width,
width = OPEN_FILTER_BAR_WIDTH

Nit: let's assign a default value as soon as possible

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

@@ -103,7 +105,7 @@ export const ActionButtons = ({
);

return (
<ActionButtonsContainer>
<ActionButtonsContainer data-test="filterbar-action-buttons" width={width || OPEN_FILTER_BAR_WIDTH}>
Copy link
Member

@ktmud ktmud Jul 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ActionButtonsContainer data-test="filterbar-action-buttons" width={width || OPEN_FILTER_BAR_WIDTH}>
<ActionButtonsContainer data-test="filterbar-action-buttons" width={width}>

No need for || if default value is assigned.

@codecov
Copy link

codecov bot commented Jul 20, 2022

Codecov Report

Merging #20778 (0c55015) into master (81bd496) will increase coverage by 0.00%.
The diff coverage is 95.45%.

@@           Coverage Diff           @@
##           master   #20778   +/-   ##
=======================================
  Coverage   66.28%   66.29%           
=======================================
  Files        1756     1757    +1     
  Lines       66756    66775   +19     
  Branches     7049     7052    +3     
=======================================
+ Hits        44252    44266   +14     
- Misses      20708    20710    +2     
- Partials     1796     1799    +3     
Flag Coverage Δ
javascript 51.94% <95.45%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...frontend/src/dashboard/components/Header/index.jsx 59.39% <ø> (ø)
...board/components/nativeFilters/FilterBar/index.tsx 60.58% <ø> (ø)
superset-frontend/src/utils/localStorageHelpers.ts 90.00% <ø> (ø)
...d/components/DashboardBuilder/DashboardBuilder.tsx 75.00% <87.50%> (+4.89%) ⬆️
...onents/DashboardBuilder/useStoredFilterBarWidth.ts 100.00% <100.00%> (ø)
...ts/nativeFilters/FilterBar/ActionButtons/index.tsx 87.50% <100.00%> (+1.78%) ⬆️
superset-frontend/src/dashboard/constants.ts 100.00% <100.00%> (ø)
...t-frontend/src/dashboard/containers/SliceAdder.jsx 0.00% <0.00%> (-100.00%) ⬇️
...rontend/src/dashboard/containers/DashboardGrid.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/featureFlags.ts 66.66% <0.00%> (-33.34%) ⬇️
... and 9 more

* Add Resizable panel in DashboardBuilder to adjust the width for FiltersPanel
* store the adjusted width for individual dashboard in localStorage to memorize the state
 * migrate DashboardBuilder test code by testing-library and jest
@justinpark justinpark force-pushed the feat--resizable-side-filter-bar branch from b402ec3 to 0c55015 Compare July 20, 2022 15:07
@ktmud ktmud merged commit 1debaca into apache:master Jul 20, 2022
@justinpark justinpark deleted the feat--resizable-side-filter-bar branch July 20, 2022 17:13
@justinpark justinpark restored the feat--resizable-side-filter-bar branch July 20, 2022 18:04
@justinpark justinpark deleted the feat--resizable-side-filter-bar branch July 20, 2022 18:05
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XL 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants